//
// Created by 高森森 on 2022/10/23.
//

#ifndef LEETCODE_SOLUTION_34_H
#define LEETCODE_SOLUTION_34_H
#include<bits/stdc++.h>
using namespace std;

class solution_34 {
public:
    int lengthOfLastWord(string s) {
        int index=s.size()-1;
        int count=0;
        while(s[index]==' '){
            index--;
        }
        while(s[index]!=' '&&index>=0){
            count++;
            index--;
        }
        return count;
    }
};


#endif //LEETCODE_SOLUTION_34_H
